# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=kubectl-krew
pkgver=0.4.3
pkgrel=0
pkgdesc="Find and install kubectl plugins"
url="https://krew.sigs.k8s.io/"
arch="x86_64 aarch64 armv7 x86" # kubectl
license="Apache-2.0"
depends="kubectl"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/kubernetes-sigs/krew/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/krew-$pkgver"

build() {
        GOLDFLAGS="
        -X sigs.k8s.io/krew/internal/version.gitCommit=AlpineLinux
        -X sigs.k8s.io/krew/internal/version.gitTag=v$pkgver
        "
        go build -tags netgo -ldflags "$GOLDFLAGS" -o bin/$pkgname ./cmd/krew/main.go
}

check() {
        KREW_BINARY="$builddir/bin/$pkgname" go test ./...
}

package() {
        install -Dm755 bin/$pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="
a9846b98e9ddcb6912df8821fc9b99ed007806a6e940032c08146b79a15896e30f6ed49780ba84f3c388cd98dba866efeec968ef4ce8eda4faa0c1426fd9b145  kubectl-krew-0.4.3.tar.gz
"
